package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(20);not null;index:ip_idx commit:'账号'"`
	Password string `gorm:"type:varchar(36);not null;index:ip_idx commit:'密码'"`
	Start    string `gorm:"type:enum('正常','冻结');not null;index:ip_idx commit:'状态'"`
}

func (u *User) Find(username string) error {
	return DB.Where("username=?", username).Find(&u).Error
}
func (u *User) Status(username int64, status string) error {
	return DB.Model(User{}).Where("username=?", username).Updates(status).Error
}
